$(() => {
  
  let $width = $("#width"),
      $height = $("#height"),
      $btnCal = $("#calc"),
      $form = $("#main"),

      $perimeter = $("#perimeter"),
      $area = $("#area"),
      $heighterr = $("#height-err"),
      $widtherr = $("#width-err");
  //$btnCal.click(() => {
  $form.submit((e) => {
    e.preventDefault();
     let w = Number($width.val()),
        h = Number($height.val());
     let  p = (w+h)*2,
        a = w*h;
  
    
        $perimeter.val(p);
        $area.val(a);
      })
    });

